<?php
// 本类由系统自动生成，仅供测试用途
class IndexAction extends Action {
	public function index(){
		header("Content-Type:text/html; charset:utf-8");
		$this->display("reg");
	}
	function add(){
		if(md5($_POST['verify']) != $_SESSION['verify']){
			$this -> error('验证码错误！');
		}
		$user = D("Users");
		if($user -> create()){
			if($user->add()){
				$this->success("注册成功！");
			} else {
				$this->error("注册失败！");
			}
		} else {
			$this->error($user->getError());
		}
	}
	public function verify(){
		import("ORG.Util.Image");
		image::buildImageVerify(4,1,'gif',60,25,'verify');
	}//验证码
	public function checkId(){
		$str = $_GET["str"];
		$user = M("Users");
		$data = $user->find($str);
		if($data){
			echo "User ID has existed!";
		} else echo "";
	}//ajax显示重名
}
?>